/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase - TypeDemo
 * <p>Powered by webrx On 2021-11-22 09:06:59
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class TypeDemo {
    public static void main(String[] args) {
        //java 8 基本类型类型byte short int long float double boolean char
        //byte short int long 整型
        byte b = 127; //-128 - 127 整数范围 1字节
        short s = 32767; //2个字节
        int i = 3;//4byte
        long n = 6;//8byte

        int age = 18;
        byte ba = 18;

        //float double 小数类型
        float f = 1;
        System.out.println(f); //1.0
        System.out.printf("%.5f%n", f);//1.00000
        double d = .567;
        System.out.printf("%.2f%n", d);//0.57

        //boolean 布尔 = 赋值  == 判断是不是一个对象
        boolean bool = true ? 1 == 3 : !true;
        System.out.println(bool);

        String s1 = new String("yes");
        String s2 = new String("yes");
        System.out.println(s1 == s2);//false

        //char 字符型
        char c1 = '中';
        char c2 = 97;
        int c3 = 'A';
        System.out.println(c1);//中
        System.out.println(c2);//a
        System.out.println(c3);//65
        int c4 = '中';
        System.out.println(c4);//20013
        System.out.println((char) 20013);//中

        float f5 = .6f;
        double d6 = 18d;
        long num = 1l; //1L long
    }
}
